dynamic class ClottedCream extends MovieClip
{
    var grav: Number = 1.2;
    var EF;
    var _name;
    var _parent;
    var _rotation;
    var _width;
    var _x;
    var _y;
    var caughtPlayer;
    var num;
    var stayCount;
    var xv;
    var yv;

    function ClottedCream()
    {
        super();
    }

    function init()
    {
        this.num = Number(this._name.substr(6, this._name.length - 6));
        this.xv = this.yv = 0;
        this.EF = this.fallEF;
        this.caughtPlayer = [];
    }

    function fallEF()
    {
        this._x = this._x + this.xv;
        this._y = this._y + this.yv;
        this.yv = this.yv + this.grav;
        if (this._parent._parent.ground.hitTest(this._x, this._y, true)) 
        {
            this.hitGround();
        }
        if (this._x < -10 || this._x > 610 || this._y > 460) 
        {
            this._parent._parent.removeObject(this);
        }
    }

    function stayEF()
    {
        var __reg3 = this._parent._parent.checkEnemyHit(this);
        if (__reg3.length > 0) 
        {
            var __reg5 = this.xv;
            for (var __reg4 in __reg3) 
            {
                var __reg2 = __reg3[__reg4];
                if (!__reg2.stopped && Math.abs(__reg2._x - this._x) < this._width / 2) 
                {
                    if (!__reg2.stopped) 
                    {
                        SoundManager.startSound("allovermeshirt");
                    }
                    __reg2.stopped = true;
                    this.caughtPlayer.push(__reg2);
                }
            }
        }
        if (this.stayCount++ > 100) 
        {
            for (__reg4 in this.caughtPlayer) 
            {
                this.caughtPlayer[__reg4].stopped = false;
            }
            this._parent._parent.removeObject(this);
        }
    }

    function hitGround()
    {
        SoundManager.startSound("splodge");
        this.stayCount = 0;
        var __reg2 = this._parent._parent.findPathPoint(this._x);
        this._y = this._parent._parent.pointsA[__reg2].y;
        this._rotation = this.getGroundA(__reg2);
        this.EF = this.stayEF;
    }

    function getGroundA(p)
    {
        if (p == 0) 
        {
            ++p;
        }
        if (p == this._parent._parent.pointsA.length - 1) 
        {
            --p;
        }
        var __reg3 = MyMath.getAngle(this._parent._parent.pointsA[p - 1].x, this._parent._parent.pointsA[p - 1].y, this._parent._parent.pointsA[p + 1].x, this._parent._parent.pointsA[p + 1].y);
        return __reg3;
    }

}
